<template>
  <view class="yuongjin">
    <view class="module" v-for="item in data.list" :key="item.id">
      <u-avatar style="margin-right: 15px;" :src="$util.img(item.headimg)"></u-avatar>
      {{ item.nickname }}
    </view>

    <u-loadmore :status="status" />
  </view>
</template>

<script>
export default {
  components: {
  },
  mixins: [],
  data() {
    return {
      data: [],
      status: 'loadmore',
      page: 1,
      pageSize: 10,
      count: 0,
      options: {}
    }
  },
  onReachBottom(){
    if (this.status == 'nomore') {
      return;
    }
    this.page = ++ this.page;
    this.dataList(this.options.type)
  },
  onShow() {
  },
  onLoad(options) {
    this.options = options
    this.dataList(this.options.type)
  },
  methods: {
    dataList(type) {
      this.status = 'loading';
      if (type == 1) {
        this.$api.sendRequest({
          url: '/api/member/liandongteamzhitui',
          data: {
            page: this.page,
            pageSize: this.pageSize
          },
          success: res => {
            this.data = res.data
            this.count = res.data.count
            this.status = this.data.list.length >= this.count ? 'nomore' : 'loadmore';
            console.log(this.data, 'this.data');
          }
        });
      } else {
        this.$api.sendRequest({
          url: '/api/member/liandongteamlist',
          data: {
            page: this.page,
            pageSize: this.pageSize
          },
          success: res => {
            this.count = res.data.count
            this.data = res.data
            console.log(this.data, 'this.data');
            this.status = this.data.list.length >= this.count? 'nomore' : 'loadmore';
            
          }
        });
      }

    }
  },
  onShareTimeline() {
    return {
      title: '鹏城快享',
      query: `source_member=${uni.getStorageSync("user_id")}`,
      imageUrl: "https://transtorecc.oss-cn-beijing.aliyuncs.com/2052/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20241018115926.png"
    }
  },
  onShareAppMessage() {
    return {
      title: "鹏城快享",
      path: `/pages/index/index?source_member=${uni.getStorageSync("user_id")}`,
      imageUrl: 'https://transtorecc.oss-cn-beijing.aliyuncs.com/2052/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20241018115926.png'
    }
  },
};
</script>

<style lang="scss" scoped>
@import '@/common/css/diy.scss';


.yuongjin {
  margin: 20rpx 30rpx;
  padding-bottom: 30px;
}

.module {
  padding: 10px;
  background: #fff;
  border-radius: 10px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
}
</style>
